package com.thread;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class TaskTest {
	
	
	public  void task1(Map<String, String> taskParam) throws InterruptedException{
		System.out.println("task 1 begin");
		System.out.println("phone:"+taskParam.get("phone")+":content:"+taskParam.get("content"));
		Thread.sleep(10000);
		System.out.println("task 1 end");
	}
	
	/**
	 * 测试多任务队列
	 * @param args
	 */
	public static void main(String[] args){
		/**设置任务列表**/
		List<TaskEntity> taskList = new ArrayList<TaskEntity>();
		TaskEntity task = null;
		Map<String, String> m = null;
		for(int i=0;i<100;i++){
			task = new TaskEntity();
			task.setTaskClass(TaskTest.class);
			task.setTaskMethod("task1");
			m = new HashMap<String,String>();
			m.put("phone", "1888888888--" + i);
			m.put("content", "测试内容---" + i);
			Object os [] = {m};
			task.setTaskParam(m);
			taskList.add(task);
		}
		/**将任务添加到队列**/
		TaskUtils.addTaskList(taskList);
	}


}
